Dataset <-
read.csv("/Users/trekkatkins/Downloads/7585259/Rasool-Winke(2019)SystemData.csv")
summary(Dataset)
## ID Institution Deg_Prog Semester
## Min. : 1 Min. :1.000 Min. : 1.000 Min. :1.000
## 1st Qu.: 58 1st Qu.:1.000 1st Qu.: 2.000 1st Qu.:1.000
## Median :115 Median :2.000 Median : 4.000 Median :4.000
## Mean :115 Mean :2.026 Mean : 9.079 Mean :3.493
## 3rd Qu.:172 3rd Qu.:3.000 3rd Qu.: 8.000 3rd Qu.:4.000
## Max. :229 Max. :3.000 Max. :999.000 Max. :8.000
## Age Gender Mother_Tong No_of_Lang
## Min. : 18.00 Min. :1.000 Min. : 1.00 Min. : 2.00
## 1st Qu.: 20.00 1st Qu.:1.000 1st Qu.: 1.00 1st Qu.: 3.00
## Median : 21.00 Median :1.000 Median : 2.00 Median : 3.00
## Mean : 42.18 Mean :1.498 Mean : 16.11 Mean : 20.95
## 3rd Qu.: 22.00 3rd Qu.:2.000 3rd Qu.: 5.00 3rd Qu.: 4.00
## Max. :999.00 Max. :2.000 Max. :999.00 Max. :999.00
## Spk_prof_Urdu Spk_prof_Eng Spk_prof_Pash Spk_prof_Balo
## Min. :0.0000 Min. : 0.000 Min. : 0.000 Min. :0.0000
## 1st Qu.:1.0000 1st Qu.: 1.000 1st Qu.: 0.000 1st Qu.:0.0000
## Median :1.0000 Median : 1.000 Median : 1.000 Median :0.0000
## Mean :0.9913 Mean : 1.109 Mean : 0.607 Mean :0.2489
## 3rd Qu.:1.0000 3rd Qu.: 1.000 3rd Qu.: 1.000 3rd Qu.:0.0000
## Max. :1.0000 Max. :11.000 Max. :11.000 Max. :1.0000
## Spk_prof_Brah Spk_prof_Sind Spk_prof_Sara Spk_prof_Pers
## Min. :0.0000 Min. :0.0000 Min. :0.00000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.0000
## Median :0.0000 Median :0.0000 Median :0.00000 Median :0.0000
## Mean :0.2009 Mean :0.0917 Mean :0.06114 Mean :0.1834
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.0000 Max. :1.00000 Max. :1.0000
## Spk_prof_Punj Spk_prof_Hind Spk_prof_Other NameOtherLang
## Min. :0.0000 Min. :0.00000 Min. :0.0000 Length:229
## 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.0000 Class :character
## Median :0.0000 Median :0.00000 Median :0.0000 Mode :character
## Mean :0.1703 Mean :0.06114 Mean :0.0524
## 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.00000 Max. :1.0000
## Lang_Aca_Ex Sp_Slf_As Rd_Slf_As Wr_Slf_As
## Min. : 0.000 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.: 0.000 1st Qu.: 2.00 1st Qu.: 1.00 1st Qu.: 1.00
## Median : 1.000 Median : 2.00 Median : 2.00 Median : 2.00
## Mean : 9.341 Mean : 19.69 Mean : 36.53 Mean : 40.97
## 3rd Qu.: 1.000 3rd Qu.: 3.00 3rd Qu.: 2.00 3rd Qu.: 2.00
## Max. :999.000 Max. :999.00 Max. :999.00 Max. :999.00
## Lis_Slf_As Item1 Item2 Item3
## Min. : 1.00 Min. : 1.000 Min. :1.000 Min. :1.000
## 1st Qu.: 1.00 1st Qu.: 2.000 1st Qu.:2.000 1st Qu.:6.000
## Median : 2.00 Median : 5.000 Median :5.000 Median :7.000
## Mean : 41.02 Mean : 8.629 Mean :4.197 Mean :6.079
## 3rd Qu.: 2.00 3rd Qu.: 6.000 3rd Qu.:6.000 3rd Qu.:7.000
## Max. :999.00 Max. :999.000 Max. :7.000 Max. :7.000
## Item4 Item5 Item6 Item7
## Min. :1.000 Min. : 1.000 Min. :1.000 Min. : 1.00
## 1st Qu.:4.000 1st Qu.: 5.000 1st Qu.:2.000 1st Qu.: 5.00
## Median :6.000 Median : 6.000 Median :3.000 Median : 6.00
## Mean :5.218 Mean : 9.716 Mean :3.227 Mean : 9.79
## 3rd Qu.:6.000 3rd Qu.: 7.000 3rd Qu.:4.000 3rd Qu.: 7.00
## Max. :7.000 Max. :999.000 Max. :7.000 Max. :999.00
## Item8 Item9 Item10 Item11
## Min. : 1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.: 3.000 1st Qu.:6.000 1st Qu.:2.000 1st Qu.:2.000
## Median : 6.000 Median :6.000 Median :4.000 Median :5.000
## Mean : 9.179 Mean :6.118 Mean :4.035 Mean :4.131
## 3rd Qu.: 6.000 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:6.000
## Max. :999.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item12 Item13 Item14 Item15
## Min. :1.000 Min. :1.000 Min. :1.00 Min. :1.000
## 1st Qu.:2.000 1st Qu.:4.000 1st Qu.:2.00 1st Qu.:4.000
## Median :5.000 Median :6.000 Median :5.00 Median :6.000
## Mean :4.415 Mean :5.183 Mean :4.21 Mean :5.271
## 3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.:6.00 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.00 Max. :7.000
## Item16 Item17 Item18 Item19
## Min. : 1.00 Min. : 1.000 Min. :1.000 Min. : 1.00
## 1st Qu.: 5.00 1st Qu.: 3.000 1st Qu.:4.000 1st Qu.: 5.00
## Median : 6.00 Median : 5.000 Median :6.000 Median : 6.00
## Mean : 22.79 Mean : 9.013 Mean :5.314 Mean : 14.24
## 3rd Qu.: 7.00 3rd Qu.: 6.000 3rd Qu.:7.000 3rd Qu.: 7.00
## Max. :999.00 Max. :999.000 Max. :7.000 Max. :999.00
## Item20 Item21 Item22 Item23
## Min. : 1.00 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.: 5.00 1st Qu.:4.000 1st Qu.:5.000 1st Qu.:6.000
## Median : 6.00 Median :6.000 Median :6.000 Median :7.000
## Mean : 13.99 Mean :5.262 Mean :5.712 Mean :6.262
## 3rd Qu.: 7.00 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :7.000 Max. :7.000
## Item24 Item25 Item26 Item27
## Min. :1.000 Min. : 1.00 Min. : 1.000 Min. :1.000
## 1st Qu.:4.000 1st Qu.: 6.00 1st Qu.: 2.000 1st Qu.:2.000
## Median :6.000 Median : 6.00 Median : 5.000 Median :3.000
## Mean :5.201 Mean : 10.33 Mean : 8.699 Mean :3.642
## 3rd Qu.:6.000 3rd Qu.: 7.00 3rd Qu.: 6.000 3rd Qu.:6.000
## Max. :7.000 Max. :999.00 Max. :999.000 Max. :7.000
## Item28 Item29 Item30 Item31
## Min. :1.000 Min. :1.000 Min. : 1.000 Min. :1.000
## 1st Qu.:5.000 1st Qu.:5.000 1st Qu.: 4.000 1st Qu.:6.000
## Median :6.000 Median :6.000 Median : 6.000 Median :6.000
## Mean :5.681 Mean :5.563 Mean : 9.345 Mean :5.996
## 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.: 7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :999.000 Max. :7.000
## Item32 Item33 Item34 Item35
## Min. : 1.00 Min. : 1.00 Min. : 1.00 Min. :1.000
## 1st Qu.: 5.00 1st Qu.: 6.00 1st Qu.: 3.00 1st Qu.:6.000
## Median : 6.00 Median : 6.00 Median : 5.00 Median :6.000
## Mean : 14.53 Mean : 10.35 Mean : 13.28 Mean :5.926
## 3rd Qu.: 7.00 3rd Qu.: 7.00 3rd Qu.: 6.00 3rd Qu.:7.000
## Max. :999.00 Max. :999.00 Max. :999.00 Max. :7.000
## item36 Item37 Item38 Item39
## Min. : 1.00 Min. :1.000 Min. : 1.00 Min. :1.000
## 1st Qu.: 2.00 1st Qu.:5.000 1st Qu.: 3.00 1st Qu.:2.000
## Median : 4.00 Median :6.000 Median : 5.00 Median :5.000
## Mean : 12.48 Mean :5.716 Mean : 13.38 Mean :4.624
## 3rd Qu.: 6.00 3rd Qu.:7.000 3rd Qu.: 6.00 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :999.00 Max. :7.000
## Item40 Item41 Item42 Item43
## Min. : 1.000 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.: 1.000 1st Qu.: 5.00 1st Qu.: 4.00 1st Qu.: 6.00
## Median : 2.000 Median : 6.00 Median : 6.00 Median : 6.00
## Mean : 7.384 Mean : 14.29 Mean : 22.45 Mean : 32.04
## 3rd Qu.: 5.000 3rd Qu.: 7.00 3rd Qu.: 7.00 3rd Qu.: 7.00
## Max. :999.000 Max. :999.00 Max. :999.00 Max. :999.00
## Item44 Item45 Item46 Item47
## Min. : 1.00 Min. :1.000 Min. : 1.00 Min. :1.000
## 1st Qu.: 5.00 1st Qu.:4.000 1st Qu.: 5.00 1st Qu.:4.000
## Median : 6.00 Median :6.000 Median : 6.00 Median :5.000
## Mean : 14.05 Mean :5.262 Mean : 14.13 Mean :4.987
## 3rd Qu.: 7.00 3rd Qu.:6.000 3rd Qu.: 7.00 3rd Qu.:6.000
## Max. :999.00 Max. :7.000 Max. :999.00 Max. :9.000
## Item48 Item49 Item50 Item51
## Min. : 1.00 Min. : 1.000 Min. :1.000 Min. :1.000
## 1st Qu.: 6.00 1st Qu.: 4.000 1st Qu.:3.000 1st Qu.:4.000
## Median : 6.00 Median : 5.000 Median :5.000 Median :6.000
## Mean : 14.67 Mean : 9.227 Mean :4.428 Mean :5.367
## 3rd Qu.: 7.00 3rd Qu.: 6.000 3rd Qu.:6.000 3rd Qu.:7.000
## Max. :999.00 Max. :999.000 Max. :7.000 Max. :7.000
## Item52 Item53 Item54
## Min. : 1.00 Min. :1.000 Min. :1.000
## 1st Qu.: 6.00 1st Qu.:6.000 1st Qu.:4.000
## Median : 6.00 Median :7.000 Median :5.000
## Mean : 18.92 Mean :6.192 Mean :4.699
## 3rd Qu.: 7.00 3rd Qu.:7.000 3rd Qu.:6.000
## Max. :999.00 Max. :7.000 Max. :7.000
#sampling
set.seed(12)
sample <- Dataset[sample(1:nrow(Dataset), 36,
replace=FALSE),]
sample$Gender <- as.factor(sample$Gender)
str(sample)
## 'data.frame': 36 obs. of 79 variables:
## $ ID : int 194 90 80 91 174 197 69 220 34 136 ...
## $ Institution : int 1 2 2 2 1 1 3 1 3 2 ...
## $ Deg_Prog : int 2 3 3 3 1 1 10 1 5 4 ...
## $ Semester : int 4 4 4 4 1 4 7 1 5 4 ...
## $ Age : int 23 22 20 23 21 24 22 20 20 22 ...
## $ Gender : Factor w/ 2 levels "1","2": 1 1 1 1 1 2 2 1 2 1 ...
## $ Mother_Tong : int 1 2 2 1 1 1 1 2 6 1 ...
## $ No_of_Lang : int 6 3 5 3 3 3 3 4 3 3 ...
## $ Spk_prof_Urdu : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Spk_prof_Eng : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Spk_prof_Pash : int 1 0 0 1 1 1 1 0 0 1 ...
## $ Spk_prof_Balo : int 1 1 1 0 0 0 0 1 0 0 ...
## $ Spk_prof_Brah : int 1 0 1 0 0 0 0 0 0 0 ...
## $ Spk_prof_Sind : int 0 0 1 0 0 0 0 1 0 0 ...
## $ Spk_prof_Sara : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Spk_prof_Pers : int 1 0 0 0 0 0 0 0 1 0 ...
## $ Spk_prof_Punj : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Spk_prof_Hind : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Spk_prof_Other: int 0 0 0 0 0 0 0 0 0 0 ...
## $ NameOtherLang : chr " " " " " " " " ...
## $ Lang_Aca_Ex : int 0 1 1 0 1 0 1 1 1 1 ...
## $ Sp_Slf_As : int 2 2 2 3 3 1 2 1 1 1 ...
## $ Rd_Slf_As : int 1 2 2 2 2 1 1 2 2 1 ...
## $ Wr_Slf_As : int 2 2 3 2 2 1 2 1 2 2 ...
## $ Lis_Slf_As : int 2 2 3 3 1 2 2 2 2 2 ...
## $ Item1 : int 2 4 6 1 1 3 2 6 5 1 ...
## $ Item2 : int 5 7 7 6 2 1 4 1 7 6 ...
## $ Item3 : int 7 6 7 7 7 3 7 5 7 6 ...
## $ Item4 : int 5 6 4 5 5 7 6 6 7 7 ...
## $ Item5 : int 5 7 6 7 7 6 2 5 6 1 ...
## $ Item6 : int 3 5 3 4 7 3 6 2 2 1 ...
## $ Item7 : int 6 7 6 6 4 6 7 7 7 5 ...
## $ Item8 : int 6 6 5 6 6 6 7 7 7 5 ...
## $ Item9 : int 5 7 7 7 6 7 7 6 7 7 ...
## $ Item10 : int 2 7 7 3 7 7 7 2 4 6 ...
## $ Item11 : int 4 1 1 7 5 1 6 6 2 3 ...
## $ Item12 : int 2 6 1 6 3 5 6 2 6 5 ...
## $ Item13 : int 6 7 4 5 6 4 7 6 7 6 ...
## $ Item14 : int 5 5 7 7 3 7 7 2 5 6 ...
## $ Item15 : int 6 1 2 2 7 7 3 2 6 7 ...
## $ Item16 : int 3 7 7 5 6 7 7 6 7 5 ...
## $ Item17 : int 1 2 2 3 5 7 7 6 6 6 ...
## $ Item18 : int 1 7 7 6 7 1 6 2 7 7 ...
## $ Item19 : int 5 6 4 5 2 7 6 7 6 5 ...
## $ Item20 : int 6 3 2 1 5 7 6 6 6 6 ...
## $ Item21 : int 4 6 2 1 7 7 7 5 6 7 ...
## $ Item22 : int 2 7 6 4 6 4 6 2 7 7 ...
## $ Item23 : int 6 5 7 6 7 7 7 6 7 7 ...
## $ Item24 : int 3 4 2 2 1 7 5 6 7 6 ...
## $ Item25 : int 6 4 4 6 6 7 6 6 6 5 ...
## $ Item26 : int 2 2 1 5 4 2 6 6 4 2 ...
## $ Item27 : int 2 5 6 1 1 5 2 2 5 3 ...
## $ Item28 : int 2 6 1 6 7 7 6 2 5 7 ...
## $ Item29 : int 2 6 7 5 7 7 7 6 6 5 ...
## $ Item30 : int 1 6 7 5 5 4 7 6 6 6 ...
## $ Item31 : int 5 7 5 5 7 7 7 6 7 7 ...
## $ Item32 : int 6 6 6 3 7 7 6 2 7 7 ...
## $ Item33 : int 6 7 2 6 7 7 4 6 7 7 ...
## $ Item34 : int 3 3 4 6 6 6 7 6 2 7 ...
## $ Item35 : int 6 7 7 6 6 7 6 6 6 7 ...
## $ item36 : int 7 1 5 3 1 5 5 7 4 5 ...
## $ Item37 : int 2 6 6 4 7 7 6 7 6 7 ...
## $ Item38 : int 2 2 2 4 4 2 6 6 3 3 ...
## $ Item39 : int 2 3 6 4 7 6 7 7 3 1 ...
## $ Item40 : int 4 4 2 1 1 1 1 2 2 3 ...
## $ Item41 : int 5 7 5 6 7 6 6 7 6 7 ...
## $ Item42 : int 3 6 2 1 7 7 6 2 5 7 ...
## $ Item43 : int 3 5 6 3 6 7 7 6 6 7 ...
## $ Item44 : int 3 4 5 4 4 7 7 6 6 7 ...
## $ Item45 : int 6 6 3 4 5 7 7 6 5 5 ...
## $ Item46 : int 6 6 6 4 4 4 6 5 6 6 ...
## $ Item47 : int 6 6 6 5 7 1 6 2 6 6 ...
## $ Item48 : int 6 6 6 4 1 7 6 6 7 6 ...
## $ Item49 : int 7 1 4 1 5 4 5 7 6 7 ...
## $ Item50 : int 6 6 1 4 5 1 6 6 3 4 ...
## $ Item51 : int 6 6 7 6 7 3 7 2 6 7 ...
## $ Item52 : int 6 7 7 6 6 7 7 7 5 7 ...
## $ Item53 : int 6 7 6 6 5 7 6 7 7 7 ...
## $ Item54 : int 2 7 2 4 6 5 5 5 6 5 ...
set.seed(34)
sample2 <- Dataset[sample(1:nrow(Dataset), 36,
replace=FALSE),]
sample2$Gender <- as.factor(sample$Gender)
str(sample2)
## 'data.frame': 36 obs. of 79 variables:
## $ ID : int 221 161 137 10 50 8 86 182 100 29 ...
## $ Institution : int 1 1 2 3 3 3 2 1 2 3 ...
## $ Deg_Prog : int 2 1 4 6 9 7 3 1 3 5 ...
## $ Semester : int 1 1 2 5 5 1 4 1 4 1 ...
## $ Age : int 19 22 19 22 20 19 21 23 20 18 ...
## $ Gender : Factor w/ 2 levels "1","2": 1 1 1 1 1 2 2 1 2 1 ...
## $ Mother_Tong : int 5 4 2 6 11 6 5 2 1 3 ...
## $ No_of_Lang : int 3 5 3 3 4 3 3 10 4 4 ...
## $ Spk_prof_Urdu : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Spk_prof_Eng : int 1 1 1 1 1 1 1 1 11 1 ...
## $ Spk_prof_Pash : int 0 1 0 0 0 0 0 1 1 0 ...
## $ Spk_prof_Balo : int 0 0 1 0 0 0 0 1 0 1 ...
## $ Spk_prof_Brah : int 0 0 0 0 1 0 0 1 0 1 ...
## $ Spk_prof_Sind : int 0 0 0 0 1 0 0 1 0 0 ...
## $ Spk_prof_Sara : int 0 0 0 0 0 0 0 1 1 0 ...
## $ Spk_prof_Pers : int 0 0 0 1 0 1 0 1 0 0 ...
## $ Spk_prof_Punj : int 1 1 0 0 0 0 1 1 0 0 ...
## $ Spk_prof_Hind : int 0 1 0 0 0 0 0 1 0 0 ...
## $ Spk_prof_Other: int 0 0 0 0 0 0 0 0 0 0 ...
## $ NameOtherLang : chr " " " " " " " " ...
## $ Lang_Aca_Ex : int 1 1 1 1 0 1 1 0 0 1 ...
## $ Sp_Slf_As : int 1 2 2 2 999 1 3 2 3 2 ...
## $ Rd_Slf_As : int 2 3 2 1 999 1 3 999 2 1 ...
## $ Wr_Slf_As : int 2 2 2 2 999 2 3 999 3 1 ...
## $ Lis_Slf_As : int 1 2 2 2 999 1 2 999 3 1 ...
## $ Item1 : int 7 1 7 5 6 1 1 1 6 6 ...
## $ Item2 : int 7 2 6 4 2 6 4 3 2 2 ...
## $ Item3 : int 7 7 7 7 1 7 6 7 6 7 ...
## $ Item4 : int 6 2 6 6 1 6 6 1 2 4 ...
## $ Item5 : int 7 4 6 7 6 6 6 4 2 6 ...
## $ Item6 : int 1 3 3 2 2 4 6 5 2 6 ...
## $ Item7 : int 6 6 6 7 1 6 1 1 6 6 ...
## $ Item8 : int 5 5 5 7 6 4 2 7 2 6 ...
## $ Item9 : int 6 7 6 7 6 6 4 7 6 7 ...
## $ Item10 : int 2 5 3 1 1 6 4 7 2 4 ...
## $ Item11 : int 7 5 7 3 2 1 3 1 6 6 ...
## $ Item12 : int 1 4 5 4 6 4 1 1 6 6 ...
## $ Item13 : int 2 6 7 7 6 6 2 7 2 5 ...
## $ Item14 : int 7 5 1 1 2 6 4 5 2 6 ...
## $ Item15 : int 7 2 7 7 1 6 5 1 6 6 ...
## $ Item16 : int 6 6 6 7 1 6 2 5 2 6 ...
## $ Item17 : int 6 6 5 4 1 4 2 7 2 7 ...
## $ Item18 : int 6 6 7 4 2 4 4 7 2 6 ...
## $ Item19 : int 7 6 7 7 6 4 4 1 6 7 ...
## $ Item20 : int 7 7 7 7 2 6 5 1 2 7 ...
## $ Item21 : int 1 5 6 7 2 7 5 7 2 6 ...
## $ Item22 : int 6 4 5 7 6 6 3 6 2 6 ...
## $ Item23 : int 6 7 7 7 6 6 6 6 6 7 ...
## $ Item24 : int 5 4 2 7 6 6 6 5 6 6 ...
## $ Item25 : int 7 6 7 7 2 6 4 7 6 7 ...
## $ Item26 : int 6 6 6 7 3 2 6 4 6 7 ...
## $ Item27 : int 2 6 1 1 2 2 2 7 2 4 ...
## $ Item28 : int 7 7 7 7 4 6 2 6 6 7 ...
## $ Item29 : int 7 7 6 7 2 6 3 1 2 7 ...
## $ Item30 : int 1 6 7 7 2 6 4 7 999 6 ...
## $ Item31 : int 6 6 7 7 6 7 5 6 2 7 ...
## $ Item32 : int 6 6 6 4 6 6 5 6 999 7 ...
## $ Item33 : int 7 7 5 7 6 6 6 4 6 7 ...
## $ Item34 : int 6 4 7 5 2 1 4 1 999 4 ...
## $ Item35 : int 6 5 6 7 5 7 2 1 6 6 ...
## $ item36 : int 7 7 2 1 4 4 2 1 999 2 ...
## $ Item37 : int 7 7 6 7 2 4 6 1 2 6 ...
## $ Item38 : int 6 5 5 6 6 2 6 1 999 6 ...
## $ Item39 : int 1 4 4 7 1 7 4 1 2 6 ...
## $ Item40 : int 2 1 3 7 3 2 2 4 999 1 ...
## $ Item41 : int 1 7 7 7 7 6 6 7 6 6 ...
## $ Item42 : int 7 7 6 7 6 6 5 1 999 7 ...
## $ Item43 : int 7 7 6 7 3 6 4 6 6 7 ...
## $ Item44 : int 7 4 6 7 4 6 2 1 999 6 ...
## $ Item45 : int 6 4 4 7 3 6 6 7 6 6 ...
## $ Item46 : int 7 5 4 7 3 6 2 1 999 6 ...
## $ Item47 : int 7 3 6 7 6 6 4 7 2 4 ...
## $ Item48 : int 7 6 7 7 6 7 6 7 6 7 ...
## $ Item49 : int 6 4 6 7 2 6 4 1 6 6 ...
## $ Item50 : int 6 5 6 5 3 1 6 1 2 6 ...
## $ Item51 : int 2 6 6 7 4 7 4 7 6 6 ...
## $ Item52 : int 7 7 5 7 999 6 6 4 6 6 ...
## $ Item53 : int 6 7 6 7 6 6 6 7 6 7 ...
## $ Item54 : int 6 5 7 4 6 6 4 1 6 2 ...
summary(sample)
## ID Institution Deg_Prog Semester
## Min. : 13.0 Min. :1.000 Min. : 1.000 Min. :1.00
## 1st Qu.: 81.5 1st Qu.:1.000 1st Qu.: 2.000 1st Qu.:1.00
## Median :126.0 Median :2.000 Median : 3.000 Median :4.00
## Mean :132.4 Mean :1.806 Mean : 4.556 Mean :3.75
## 3rd Qu.:186.5 3rd Qu.:2.000 3rd Qu.: 5.250 3rd Qu.:4.25
## Max. :226.0 Max. :3.000 Max. :13.000 Max. :8.00
## Age Gender Mother_Tong No_of_Lang Spk_prof_Urdu
## Min. :18.00 1:21 Min. :1.000 Min. :2.000 Min. :1
## 1st Qu.:20.00 2:15 1st Qu.:1.000 1st Qu.:3.000 1st Qu.:1
## Median :21.00 Median :1.000 Median :3.000 Median :1
## Mean :21.08 Mean :1.861 Mean :3.639 Mean :1
## 3rd Qu.:22.00 3rd Qu.:2.000 3rd Qu.:4.000 3rd Qu.:1
## Max. :24.00 Max. :6.000 Max. :8.000 Max. :1
## Spk_prof_Eng Spk_prof_Pash Spk_prof_Balo Spk_prof_Brah
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:1.0000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :1.0000 Median :1.0000 Median :0.0000 Median :0.0000
## Mean :0.9722 Mean :0.6111 Mean :0.2778 Mean :0.1667
## 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## Spk_prof_Sind Spk_prof_Sara Spk_prof_Pers Spk_prof_Punj
## Min. :0.0000 Min. :0.00000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0.0000 Median :0.00000 Median :0.0000 Median :0.0000
## Mean :0.1111 Mean :0.02778 Mean :0.2222 Mean :0.1667
## 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.00000 Max. :1.0000 Max. :1.0000
## Spk_prof_Hind Spk_prof_Other NameOtherLang Lang_Aca_Ex
## Min. :0.00000 Min. :0.00000 Length:36 Min. :0.0000
## 1st Qu.:0.00000 1st Qu.:0.00000 Class :character 1st Qu.:0.0000
## Median :0.00000 Median :0.00000 Mode :character Median :1.0000
## Mean :0.02778 Mean :0.05556 Mean :0.6111
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:1.0000
## Max. :1.00000 Max. :1.00000 Max. :1.0000
## Sp_Slf_As Rd_Slf_As Wr_Slf_As Lis_Slf_As
## Min. : 1.00 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.: 2.00 1st Qu.: 1.00 1st Qu.: 2.00 1st Qu.: 2.00
## Median : 2.00 Median : 2.00 Median : 2.00 Median : 2.00
## Mean : 57.42 Mean : 84.75 Mean : 84.94 Mean : 85.11
## 3rd Qu.: 3.00 3rd Qu.: 2.00 3rd Qu.: 2.00 3rd Qu.: 2.00
## Max. :999.00 Max. :999.00 Max. :999.00 Max. :999.00
## Item1 Item2 Item3 Item4 Item5
## Min. :1.000 Min. :1.00 Min. :3.000 Min. :1.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:2.00 1st Qu.:7.000 1st Qu.:5.000 1st Qu.:5.000
## Median :6.000 Median :6.00 Median :7.000 Median :6.000 Median :6.000
## Mean :4.722 Mean :4.50 Mean :6.639 Mean :5.583 Mean :5.583
## 3rd Qu.:7.000 3rd Qu.:6.25 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.00 Max. :7.000 Max. :7.000 Max. :7.000
## Item6 Item7 Item8 Item9 Item10
## Min. :1.000 Min. :2.000 Min. :1.000 Min. :4.0 Min. :1.000
## 1st Qu.:2.000 1st Qu.:5.000 1st Qu.:4.000 1st Qu.:6.0 1st Qu.:1.000
## Median :3.000 Median :6.000 Median :6.000 Median :7.0 Median :3.000
## Mean :3.333 Mean :5.861 Mean :5.194 Mean :6.5 Mean :3.778
## 3rd Qu.:4.000 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.0 3rd Qu.:6.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.0 Max. :7.000
## Item11 Item12 Item13 Item14 Item15
## Min. :1 Min. :1.00 Min. :1.000 Min. :1.000 Min. :1.00
## 1st Qu.:2 1st Qu.:3.00 1st Qu.:4.000 1st Qu.:2.750 1st Qu.:4.75
## Median :4 Median :6.00 Median :6.000 Median :5.500 Median :6.00
## Mean :4 Mean :4.75 Mean :5.417 Mean :4.611 Mean :5.50
## 3rd Qu.:6 3rd Qu.:6.00 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:7.00
## Max. :7 Max. :7.00 Max. :7.000 Max. :7.000 Max. :7.00
## Item16 Item17 Item18 Item19
## Min. :3.000 Min. :1.000 Min. :1.000 Min. :2.000
## 1st Qu.:5.750 1st Qu.:2.750 1st Qu.:6.000 1st Qu.:5.000
## Median :6.000 Median :6.000 Median :6.500 Median :6.000
## Mean :6.028 Mean :4.806 Mean :5.972 Mean :5.778
## 3rd Qu.:7.000 3rd Qu.:6.250 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item20 Item21 Item22 Item23 Item24
## Min. :1.000 Min. :1 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:5.000 1st Qu.:4 1st Qu.:5.000 1st Qu.:6.000 1st Qu.:4.000
## Median :6.000 Median :6 Median :6.000 Median :7.000 Median :6.000
## Mean :5.611 Mean :5 Mean :5.528 Mean :6.333 Mean :5.167
## 3rd Qu.:7.000 3rd Qu.:6 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7 Max. :7.000 Max. :7.000 Max. :7.000
## Item25 Item26 Item27 Item28
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:6.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:5.000
## Median :6.500 Median :5.000 Median :3.000 Median :6.000
## Mean :6.139 Mean :4.111 Mean :3.528 Mean :5.556
## 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item29 Item30 Item31 Item32
## Min. :2.000 Min. :1.000 Min. :5.000 Min. :2.000
## 1st Qu.:6.000 1st Qu.:5.000 1st Qu.:6.000 1st Qu.:6.000
## Median :6.000 Median :6.000 Median :7.000 Median :7.000
## Mean :6.222 Mean :5.194 Mean :6.444 Mean :6.167
## 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item33 Item34 Item35 item36
## Min. :2.000 Min. :1.000 Min. :2.000 Min. :1.000
## 1st Qu.:6.000 1st Qu.:4.000 1st Qu.:6.000 1st Qu.:2.000
## Median :6.500 Median :6.000 Median :6.000 Median :4.500
## Mean :6.139 Mean :4.917 Mean :6.167 Mean :4.111
## 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.:6.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item37 Item38 Item39 Item40 Item41
## Min. :1.000 Min. :1 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:6.000 1st Qu.:2 1st Qu.:2.750 1st Qu.:1.000 1st Qu.:5.000
## Median :6.500 Median :4 Median :5.000 Median :2.000 Median :6.000
## Mean :5.917 Mean :4 Mean :4.528 Mean :3.111 Mean :5.694
## 3rd Qu.:7.000 3rd Qu.:6 3rd Qu.:7.000 3rd Qu.:5.250 3rd Qu.:7.000
## Max. :7.000 Max. :7 Max. :7.000 Max. :7.000 Max. :7.000
## Item42 Item43 Item44 Item45 Item46
## Min. :1.0 Min. :3 Min. :1.000 Min. :1.000 Min. :2.000
## 1st Qu.:5.0 1st Qu.:6 1st Qu.:4.750 1st Qu.:5.000 1st Qu.:5.000
## Median :6.0 Median :6 Median :6.000 Median :6.000 Median :6.000
## Mean :5.5 Mean :6 Mean :5.389 Mean :5.417 Mean :5.611
## 3rd Qu.:7.0 3rd Qu.:7 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:6.000
## Max. :7.0 Max. :7 Max. :7.000 Max. :7.000 Max. :7.000
## Item47 Item48 Item49 Item50
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:4.000 1st Qu.:6.000 1st Qu.:4.000 1st Qu.:2.000
## Median :6.000 Median :6.000 Median :6.000 Median :5.000
## Mean :5.111 Mean :6.222 Mean :5.028 Mean :4.278
## 3rd Qu.:6.250 3rd Qu.:7.000 3rd Qu.:6.000 3rd Qu.:6.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item51 Item52 Item53 Item54
## Min. :1.000 Min. :4.000 Min. :2.000 Min. :1.000
## 1st Qu.:5.750 1st Qu.:6.000 1st Qu.:6.000 1st Qu.:3.750
## Median :6.000 Median :7.000 Median :6.000 Median :5.000
## Mean :5.583 Mean :6.389 Mean :6.278 Mean :4.667
## 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:6.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
summary(sample2)
## ID Institution Deg_Prog Semester
## Min. : 8.0 Min. :1.000 Min. : 1.000 Min. :1.000
## 1st Qu.: 43.5 1st Qu.:1.000 1st Qu.: 2.000 1st Qu.:1.000
## Median : 99.5 Median :2.000 Median : 3.500 Median :4.000
## Mean :110.1 Mean :2.028 Mean : 4.056 Mean :3.056
## 3rd Qu.:172.2 3rd Qu.:3.000 3rd Qu.: 5.250 3rd Qu.:4.000
## Max. :222.0 Max. :3.000 Max. :10.000 Max. :7.000
## Age Gender Mother_Tong No_of_Lang Spk_prof_Urdu
## Min. : 18.00 1:21 Min. : 1.000 Min. : 2.000 Min. :1
## 1st Qu.: 19.75 2:15 1st Qu.: 2.000 1st Qu.: 3.000 1st Qu.:1
## Median : 20.00 Median : 4.000 Median : 3.000 Median :1
## Mean : 47.86 Mean : 4.167 Mean : 3.444 Mean :1
## 3rd Qu.: 22.00 3rd Qu.: 6.000 3rd Qu.: 4.000 3rd Qu.:1
## Max. :999.00 Max. :11.000 Max. :10.000 Max. :1
## Spk_prof_Eng Spk_prof_Pash Spk_prof_Balo Spk_prof_Brah
## Min. : 0.00 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.: 1.00 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median : 1.00 Median :0.0000 Median :0.0000 Median :0.0000
## Mean : 1.25 Mean :0.3056 Mean :0.1944 Mean :0.1944
## 3rd Qu.: 1.00 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :11.00 Max. :1.0000 Max. :1.0000 Max. :1.0000
## Spk_prof_Sind Spk_prof_Sara Spk_prof_Pers Spk_prof_Punj
## Min. :0.0000 Min. :0.00000 Min. :0.00 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.00 1st Qu.:0.0000
## Median :0.0000 Median :0.00000 Median :0.00 Median :0.0000
## Mean :0.1111 Mean :0.08333 Mean :0.25 Mean :0.2222
## 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.25 3rd Qu.:0.0000
## Max. :1.0000 Max. :1.00000 Max. :1.00 Max. :1.0000
## Spk_prof_Hind Spk_prof_Other NameOtherLang Lang_Aca_Ex
## Min. :0.0000 Min. :0.00000 Length:36 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.00000 Class :character 1st Qu.:0.0000
## Median :0.0000 Median :0.00000 Mode :character Median :1.0000
## Mean :0.1111 Mean :0.02778 Mean :0.7222
## 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:1.0000
## Max. :1.0000 Max. :1.00000 Max. :1.0000
## Sp_Slf_As Rd_Slf_As Wr_Slf_As Lis_Slf_As
## Min. : 1.00 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.: 2.00 1st Qu.: 1.00 1st Qu.: 1.00 1st Qu.: 1.00
## Median : 2.00 Median : 2.00 Median : 2.00 Median : 2.00
## Mean : 29.72 Mean : 57.36 Mean : 57.25 Mean : 57.25
## 3rd Qu.: 2.25 3rd Qu.: 2.00 3rd Qu.: 2.00 3rd Qu.: 2.00
## Max. :999.00 Max. :999.00 Max. :999.00 Max. :999.00
## Item1 Item2 Item3 Item4 Item5
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.00 Min. :1.000
## 1st Qu.:1.000 1st Qu.:2.000 1st Qu.:6.000 1st Qu.:4.75 1st Qu.:5.000
## Median :5.000 Median :4.000 Median :7.000 Median :6.00 Median :6.000
## Mean :3.917 Mean :4.028 Mean :6.111 Mean :5.25 Mean :5.556
## 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.:6.00 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.00 Max. :7.000
## Item6 Item7 Item8 Item9
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:5.000 1st Qu.:4.000 1st Qu.:6.000
## Median :3.000 Median :6.000 Median :6.000 Median :6.000
## Mean :3.389 Mean :5.333 Mean :4.972 Mean :6.083
## 3rd Qu.:4.250 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item10 Item11 Item12 Item13 Item14
## Min. :1.000 Min. :1.000 Min. :1 Min. :1.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:1.750 1st Qu.:2 1st Qu.:4.000 1st Qu.:2.000
## Median :4.000 Median :4.000 Median :4 Median :6.000 Median :6.000
## Mean :4.111 Mean :3.833 Mean :4 Mean :5.194 Mean :4.667
## 3rd Qu.:6.000 3rd Qu.:6.000 3rd Qu.:6 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.000 Max. :7.000 Max. :7 Max. :7.000 Max. :7.000
## Item15 Item16 Item17 Item18
## Min. :1.000 Min. : 1.00 Min. :1.000 Min. :1.000
## 1st Qu.:4.750 1st Qu.: 6.00 1st Qu.:3.000 1st Qu.:4.000
## Median :6.000 Median : 6.00 Median :5.000 Median :6.000
## Mean :5.278 Mean : 33.36 Mean :4.722 Mean :5.167
## 3rd Qu.:7.000 3rd Qu.: 7.00 3rd Qu.:6.000 3rd Qu.:7.000
## Max. :7.000 Max. :999.00 Max. :7.000 Max. :7.000
## Item19 Item20 Item21 Item22 Item23
## Min. :1.00 Min. :1.000 Min. :1.000 Min. :2.000 Min. :5.000
## 1st Qu.:5.00 1st Qu.:4.000 1st Qu.:4.750 1st Qu.:5.000 1st Qu.:6.000
## Median :6.00 Median :6.000 Median :6.000 Median :6.000 Median :6.500
## Mean :5.75 Mean :5.306 Mean :5.278 Mean :5.472 Mean :6.444
## 3rd Qu.:7.00 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :7.00 Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
## Item24 Item25 Item26 Item27
## Min. :1.000 Min. :2.000 Min. : 1.00 Min. :1.000
## 1st Qu.:5.000 1st Qu.:5.750 1st Qu.: 2.00 1st Qu.:2.000
## Median :6.000 Median :7.000 Median : 5.00 Median :4.000
## Mean :5.361 Mean :6.167 Mean : 31.83 Mean :3.944
## 3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.: 6.00 3rd Qu.:6.000
## Max. :7.000 Max. :7.000 Max. :999.00 Max. :7.000
## Item28 Item29 Item30 Item31
## Min. :2.000 Min. :1.00 Min. : 1.00 Min. :2.000
## 1st Qu.:6.000 1st Qu.:5.75 1st Qu.: 4.00 1st Qu.:6.000
## Median :6.000 Median :6.00 Median : 6.00 Median :6.500
## Mean :5.944 Mean :5.75 Mean : 32.69 Mean :6.083
## 3rd Qu.:7.000 3rd Qu.:7.00 3rd Qu.: 7.00 3rd Qu.:7.000
## Max. :7.000 Max. :7.00 Max. :999.00 Max. :7.000
## Item32 Item33 Item34 Item35
## Min. : 3.00 Min. :4.000 Min. : 1.00 Min. :1.000
## 1st Qu.: 5.75 1st Qu.:6.000 1st Qu.: 2.75 1st Qu.:6.000
## Median : 6.00 Median :7.000 Median : 5.00 Median :6.000
## Mean : 33.58 Mean :6.306 Mean : 31.89 Mean :5.972
## 3rd Qu.: 7.00 3rd Qu.:7.000 3rd Qu.: 6.00 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :999.00 Max. :7.000
## item36 Item37 Item38 Item39
## Min. : 1.00 Min. :1.000 Min. : 1.00 Min. :1.000
## 1st Qu.: 2.00 1st Qu.:5.000 1st Qu.: 3.50 1st Qu.:2.000
## Median : 4.00 Median :6.500 Median : 5.00 Median :4.000
## Mean : 31.33 Mean :5.806 Mean : 31.97 Mean :4.278
## 3rd Qu.: 5.00 3rd Qu.:7.000 3rd Qu.: 6.00 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :999.00 Max. :7.000
## Item40 Item41 Item42 Item43
## Min. : 1.00 Min. :1.000 Min. : 1.00 Min. :3.000
## 1st Qu.: 1.00 1st Qu.:6.000 1st Qu.: 5.00 1st Qu.:6.000
## Median : 2.00 Median :6.500 Median : 6.00 Median :7.000
## Mean : 30.03 Mean :6.167 Mean : 60.64 Mean :6.111
## 3rd Qu.: 3.25 3rd Qu.:7.000 3rd Qu.: 7.00 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :999.00 Max. :7.000
## Item44 Item45 Item46 Item47
## Min. : 1.00 Min. :1.00 Min. : 1.00 Min. :1.000
## 1st Qu.: 5.00 1st Qu.:4.00 1st Qu.: 4.00 1st Qu.:4.000
## Median : 6.00 Median :6.00 Median : 6.00 Median :6.000
## Mean : 33.19 Mean :5.25 Mean : 32.97 Mean :5.167
## 3rd Qu.: 7.00 3rd Qu.:7.00 3rd Qu.: 7.00 3rd Qu.:7.000
## Max. :999.00 Max. :7.00 Max. :999.00 Max. :7.000
## Item48 Item49 Item50 Item51
## Min. : 2.00 Min. :1.000 Min. :1.000 Min. :2.000
## 1st Qu.: 6.00 1st Qu.:2.750 1st Qu.:2.000 1st Qu.:5.000
## Median : 7.00 Median :5.000 Median :5.000 Median :6.000
## Mean : 33.89 Mean :4.417 Mean :3.861 Mean :5.639
## 3rd Qu.: 7.00 3rd Qu.:6.000 3rd Qu.:5.250 3rd Qu.:7.000
## Max. :999.00 Max. :7.000 Max. :6.000 Max. :7.000
## Item52 Item53 Item54
## Min. : 2.00 Min. :5.000 Min. :1.000
## 1st Qu.: 6.00 1st Qu.:6.000 1st Qu.:4.000
## Median : 6.00 Median :6.000 Median :5.000
## Mean : 33.69 Mean :6.361 Mean :5.028
## 3rd Qu.: 7.00 3rd Qu.:7.000 3rd Qu.:6.000
## Max. :999.00 Max. :7.000 Max. :7.000
head(sample)
## ID Institution Deg_Prog Semester Age Gender Mother_Tong No_of_Lang
## 194 194 1 2 4 23 1 1 6
## 90 90 2 3 4 22 1 2 3
## 80 80 2 3 4 20 1 2 5
## 91 91 2 3 4 23 1 1 3
## 174 174 1 1 1 21 1 1 3
## 197 197 1 1 4 24 2 1 3
## Spk_prof_Urdu Spk_prof_Eng Spk_prof_Pash Spk_prof_Balo Spk_prof_Brah
## 194 1 1 1 1 1
## 90 1 1 0 1 0
## 80 1 1 0 1 1
## 91 1 1 1 0 0
## 174 1 1 1 0 0
## 197 1 1 1 0 0
## Spk_prof_Sind Spk_prof_Sara Spk_prof_Pers Spk_prof_Punj Spk_prof_Hind
## 194 0 0 1 0 0
## 90 0 0 0 0 0
## 80 1 0 0 0 0
## 91 0 0 0 0 0
## 174 0 0 0 0 0
## 197 0 0 0 0 0
## Spk_prof_Other NameOtherLang Lang_Aca_Ex Sp_Slf_As Rd_Slf_As Wr_Slf_As
## 194 0 0 2 1 2
## 90 0 1 2 2 2
## 80 0 1 2 2 3
## 91 0 0 3 2 2
## 174 0 1 3 2 2
## 197 0 0 1 1 1
## Lis_Slf_As Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10
## 194 2 2 5 7 5 5 3 6 6 5 2
## 90 2 4 7 6 6 7 5 7 6 7 7
## 80 3 6 7 7 4 6 3 6 5 7 7
## 91 3 1 6 7 5 7 4 6 6 7 3
## 174 1 1 2 7 5 7 7 4 6 6 7
## 197 2 3 1 3 7 6 3 6 6 7 7
## Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19 Item20
## 194 4 2 6 5 6 3 1 1 5 6
## 90 1 6 7 5 1 7 2 7 6 3
## 80 1 1 4 7 2 7 2 7 4 2
## 91 7 6 5 7 2 5 3 6 5 1
## 174 5 3 6 3 7 6 5 7 2 5
## 197 1 5 4 7 7 7 7 1 7 7
## Item21 Item22 Item23 Item24 Item25 Item26 Item27 Item28 Item29 Item30
## 194 4 2 6 3 6 2 2 2 2 1
## 90 6 7 5 4 4 2 5 6 6 6
## 80 2 6 7 2 4 1 6 1 7 7
## 91 1 4 6 2 6 5 1 6 5 5
## 174 7 6 7 1 6 4 1 7 7 5
## 197 7 4 7 7 7 2 5 7 7 4
## Item31 Item32 Item33 Item34 Item35 item36 Item37 Item38 Item39 Item40
## 194 5 6 6 3 6 7 2 2 2 4
## 90 7 6 7 3 7 1 6 2 3 4
## 80 5 6 2 4 7 5 6 2 6 2
## 91 5 3 6 6 6 3 4 4 4 1
## 174 7 7 7 6 6 1 7 4 7 1
## 197 7 7 7 6 7 5 7 2 6 1
## Item41 Item42 Item43 Item44 Item45 Item46 Item47 Item48 Item49 Item50
## 194 5 3 3 3 6 6 6 6 7 6
## 90 7 6 5 4 6 6 6 6 1 6
## 80 5 2 6 5 3 6 6 6 4 1
## 91 6 1 3 4 4 4 5 4 1 4
## 174 7 7 6 4 5 4 7 1 5 5
## 197 6 7 7 7 7 4 1 7 4 1
## Item51 Item52 Item53 Item54
## 194 6 6 6 2
## 90 6 7 7 7
## 80 7 7 6 2
## 91 6 6 6 4
## 174 7 6 5 6
## 197 3 7 7 5
head(sample2)
## ID Institution Deg_Prog Semester Age Gender Mother_Tong No_of_Lang
## 221 221 1 2 1 19 1 5 3
## 161 161 1 1 1 22 1 4 5
## 137 137 2 4 2 19 1 2 3
## 10 10 3 6 5 22 1 6 3
## 50 50 3 9 5 20 1 11 4
## 8 8 3 7 1 19 2 6 3
## Spk_prof_Urdu Spk_prof_Eng Spk_prof_Pash Spk_prof_Balo Spk_prof_Brah
## 221 1 1 0 0 0
## 161 1 1 1 0 0
## 137 1 1 0 1 0
## 10 1 1 0 0 0
## 50 1 1 0 0 1
## 8 1 1 0 0 0
## Spk_prof_Sind Spk_prof_Sara Spk_prof_Pers Spk_prof_Punj Spk_prof_Hind
## 221 0 0 0 1 0
## 161 0 0 0 1 1
## 137 0 0 0 0 0
## 10 0 0 1 0 0
## 50 1 0 0 0 0
## 8 0 0 1 0 0
## Spk_prof_Other NameOtherLang Lang_Aca_Ex Sp_Slf_As Rd_Slf_As Wr_Slf_As
## 221 0 1 1 2 2
## 161 0 1 2 3 2
## 137 0 1 2 2 2
## 10 0 1 2 1 2
## 50 0 0 999 999 999
## 8 0 1 1 1 2
## Lis_Slf_As Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10
## 221 1 7 7 7 6 7 1 6 5 6 2
## 161 2 1 2 7 2 4 3 6 5 7 5
## 137 2 7 6 7 6 6 3 6 5 6 3
## 10 2 5 4 7 6 7 2 7 7 7 1
## 50 999 6 2 1 1 6 2 1 6 6 1
## 8 1 1 6 7 6 6 4 6 4 6 6
## Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19 Item20
## 221 7 1 2 7 7 6 6 6 7 7
## 161 5 4 6 5 2 6 6 6 6 7
## 137 7 5 7 1 7 6 5 7 7 7
## 10 3 4 7 1 7 7 4 4 7 7
## 50 2 6 6 2 1 1 1 2 6 2
## 8 1 4 6 6 6 6 4 4 4 6
## Item21 Item22 Item23 Item24 Item25 Item26 Item27 Item28 Item29 Item30
## 221 1 6 6 5 7 6 2 7 7 1
## 161 5 4 7 4 6 6 6 7 7 6
## 137 6 5 7 2 7 6 1 7 6 7
## 10 7 7 7 7 7 7 1 7 7 7
## 50 2 6 6 6 2 3 2 4 2 2
## 8 7 6 6 6 6 2 2 6 6 6
## Item31 Item32 Item33 Item34 Item35 item36 Item37 Item38 Item39 Item40
## 221 6 6 7 6 6 7 7 6 1 2
## 161 6 6 7 4 5 7 7 5 4 1
## 137 7 6 5 7 6 2 6 5 4 3
## 10 7 4 7 5 7 1 7 6 7 7
## 50 6 6 6 2 5 4 2 6 1 3
## 8 7 6 6 1 7 4 4 2 7 2
## Item41 Item42 Item43 Item44 Item45 Item46 Item47 Item48 Item49 Item50
## 221 1 7 7 7 6 7 7 7 6 6
## 161 7 7 7 4 4 5 3 6 4 5
## 137 7 6 6 6 4 4 6 7 6 6
## 10 7 7 7 7 7 7 7 7 7 5
## 50 7 6 3 4 3 3 6 6 2 3
## 8 6 6 6 6 6 6 6 7 6 1
## Item51 Item52 Item53 Item54
## 221 2 7 6 6
## 161 6 7 7 5
## 137 6 5 6 7
## 10 7 7 7 4
## 50 4 999 6 6
## 8 7 6 6 6
table(sample$Gender)
##
## 1 2
## 21 15
table(sample2$Gender)
##
## 1 2
## 21 15
cor(sample[,c("Item16", "Mother_Tong", "Age","Item3","Item7", "Item8", "Item48", "Item49", "Item52", "Item54")])
## Item16 Mother_Tong Age Item3 Item7
## Item16 1.00000000 0.108638866 -0.037260472 -0.167716539 0.396187423
## Mother_Tong 0.10863887 1.000000000 -0.007933954 -0.063457724 -0.058158925
## Age -0.03726047 -0.007933954 1.000000000 -0.272404673 -0.120648386
## Item3 -0.16771654 -0.063457724 -0.272404673 1.000000000 0.031602401
## Item7 0.39618742 -0.058158925 -0.120648386 0.031602401 1.000000000
## Item8 0.38459306 0.231114460 0.174514798 -0.043704640 0.405685855
## Item48 0.08476510 0.138402615 -0.149454909 -0.003186459 0.321571796
## Item49 0.14854099 0.022020299 -0.313007754 -0.028357727 0.362953298
## Item52 -0.04461150 0.096349272 -0.152232441 -0.202986427 -0.001587372
## Item54 0.55253446 0.201411959 0.094757843 0.064200269 0.430577803
## Item8 Item48 Item49 Item52 Item54
## Item16 0.38459306 0.084765102 0.14854099 -0.044611501 0.55253446
## Mother_Tong 0.23111446 0.138402615 0.02202030 0.096349272 0.20141196
## Age 0.17451480 -0.149454909 -0.31300775 -0.152232441 0.09475784
## Item3 -0.04370464 -0.003186459 -0.02835773 -0.202986427 0.06420027
## Item7 0.40568586 0.321571796 0.36295330 -0.001587372 0.43057780
## Item8 1.00000000 0.085945640 0.09499393 0.177125455 0.66224930
## Item48 0.08594564 1.000000000 0.12763224 0.213352141 0.10126756
## Item49 0.09499393 0.127632240 1.00000000 0.030105398 0.20189573
## Item52 0.17712546 0.213352141 0.03010540 1.000000000 0.16387567
## Item54 0.66224930 0.101267556 0.20189573 0.163875672 1.00000000
cor(sample2[,c("Item16", "Mother_Tong", "Age","Item3","Item7", "Item8", "Item48", "Item49", "Item52", "Item54")])
## Item16 Mother_Tong Age Item3 Item7
## Item16 1.00000000 -0.13637086 0.99991903 -0.12013014 -0.028317425
## Mother_Tong -0.13637086 1.00000000 -0.13507353 -0.28673329 -0.276432803
## Age 0.99991903 -0.13507353 1.00000000 -0.12275420 -0.036730802
## Item3 -0.12013014 -0.28673329 -0.12275420 1.00000000 0.269850234
## Item7 -0.02831742 -0.27643280 -0.03673080 0.26985023 1.000000000
## Item8 0.10127112 -0.02844238 0.10276437 -0.03027508 0.003193161
## Item48 0.99995584 -0.13551698 0.99992221 -0.12289281 -0.032454027
## Item49 -0.03342915 0.02847840 -0.03957423 0.09528588 0.472023722
## Item52 -0.03776392 0.42697565 -0.03355282 -0.56673640 -0.437716747
## Item54 -0.11084009 0.11088094 -0.11247319 0.20984828 0.264496654
## Item8 Item48 Item49 Item52 Item54
## Item16 0.101271124 0.99995584 -0.03342915 -0.03776392 -0.110840086
## Mother_Tong -0.028442378 -0.13551698 0.02847840 0.42697565 0.110880941
## Age 0.102764371 0.99992221 -0.03957423 -0.03355282 -0.112473193
## Item3 -0.030275078 -0.12289281 0.09528588 -0.56673640 0.209848282
## Item7 0.003193161 -0.03245403 0.47202372 -0.43771675 0.264496654
## Item8 1.000000000 0.10206506 -0.15812645 0.09938337 -0.009986593
## Item48 0.102065057 1.00000000 -0.03447422 -0.03314801 -0.111617808
## Item49 -0.158126446 -0.03447422 1.00000000 -0.20563377 0.204114360
## Item52 0.099383372 -0.03314801 -0.20563377 1.00000000 0.106273942
## Item54 -0.009986593 -0.11161781 0.20411436 0.10627394 1.000000000
par(mfrow = c(1, 2))
hist(sample$Item16)
boxplot(sample$Item16)
hist(sample$Age)
boxplot(sample$Age)
#hist(sample$Gender)
#boxplot(sample$Gender)
hist(sample$Item3)
boxplot(sample$Item3)
hist(sample$Item7)
boxplot(sample$Item7)
hist(sample$Item8)
boxplot(sample$Item8)
hist(sample$Item48)
boxplot(sample$Item48)
hist(sample$Item49)
boxplot(sample$Item49)
hist(sample$Item52)
boxplot(sample$Item52)
hist(sample$Item54)
boxplot(sample$Item54)
par(mfrow = c(1, 2))
hist(sample2$Item16)
boxplot(sample2$Item16)
hist(sample2$Age)
boxplot(sample2$Age)
#hist(sample$Gender)
#boxplot(sample$Gender)
hist(sample2$Item3)
boxplot(sample2$Item3)
hist(sample2$Item7)
boxplot(sample2$Item7)
hist(sample2$Item8)
boxplot(sample2$Item8)
hist(sample2$Item48)
boxplot(sample2$Item48)
hist(sample2$Item49)
boxplot(sample2$Item49)
hist(sample2$Item52)
boxplot(sample2$Item52)
hist(sample2$Item54)
boxplot(sample2$Item54)
summary(m0 <- lm(Item16 ~ Age, data = sample))
##
## Call:
## lm(formula = Item16 ~ Age, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.03016 -0.33028 -0.00153 0.96984 1.05575
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.63154 2.78330 2.383 0.0229 *
## Age -0.02864 0.13172 -0.217 0.8292
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.123 on 34 degrees of freedom
## Multiple R-squared: 0.001388, Adjusted R-squared: -0.02798
## F-statistic: 0.04727 on 1 and 34 DF, p-value: 0.8292
summary(m1 <- lm(Item16 ~ Age + Gender, data = sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.90476 -0.44442 0.09524 0.93127 1.13115
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.65891 2.79904 2.379 0.0233 *
## Age -0.03591 0.13277 -0.270 0.7885
## Gender2 0.30242 0.38283 0.790 0.4352
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.13 on 33 degrees of freedom
## Multiple R-squared: 0.01992, Adjusted R-squared: -0.03948
## F-statistic: 0.3354 on 2 and 33 DF, p-value: 0.7175
AIC(m0) - AIC(m1)
## [1] -1.325603
summary(m2 <- lm(Item16 ~ Age + Gender + Item3, data = sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8387 -0.4538 0.1248 1.0061 1.2343
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.99003 3.63255 2.475 0.0188 *
## Age -0.07297 0.13775 -0.530 0.6000
## Gender2 0.26798 0.38428 0.697 0.4906
## Item3 -0.23129 0.22979 -1.007 0.3217
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.129 on 32 degrees of freedom
## Multiple R-squared: 0.05, Adjusted R-squared: -0.03907
## F-statistic: 0.5614 on 3 and 32 DF, p-value: 0.6444
AIC(m1) - AIC(m2)
## [1] -0.8779507
summary(m3 <- lm(Item16 ~ Age + Gender + Item3 + Item7, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.9213 -0.8489 0.1313 0.7150 1.4862
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.26157 3.60208 1.738 0.0921 .
## Age -0.03227 0.13033 -0.248 0.8061
## Gender2 0.01289 0.37661 0.034 0.9729
## Item3 -0.24418 0.21550 -1.133 0.2659
## Item7 0.35185 0.15131 2.325 0.0268 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.059 on 31 degrees of freedom
## Multiple R-squared: 0.1911, Adjusted R-squared: 0.08671
## F-statistic: 1.831 on 4 and 31 DF, p-value: 0.148
AIC(m2) - AIC(m3)
## [1] 3.787858
summary(m4 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8434 -0.6731 0.3032 0.6863 1.5421
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.31319 3.54741 2.062 0.0480 *
## Age -0.09513 0.13162 -0.723 0.4754
## Gender2 0.24010 0.38857 0.618 0.5413
## Item3 -0.23409 0.20913 -1.119 0.2719
## Item7 0.20087 0.17112 1.174 0.2497
## Item8 0.19193 0.11183 1.716 0.0964 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.027 on 30 degrees of freedom
## Multiple R-squared: 0.2634, Adjusted R-squared: 0.1406
## F-statistic: 2.146 on 5 and 30 DF, p-value: 0.08706
AIC(m3) - AIC(m4)
## [1] 1.371938
summary(m5 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8428 -0.7096 0.2147 0.6933 1.5850
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.69621 3.78504 2.033 0.0513 .
## Age -0.10063 0.13467 -0.747 0.4609
## Gender2 0.24682 0.39500 0.625 0.5370
## Item3 -0.23708 0.21250 -1.116 0.2737
## Item7 0.21546 0.17930 1.202 0.2392
## Item8 0.19178 0.11353 1.689 0.1019
## Item48 -0.05379 0.16357 -0.329 0.7447
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.043 on 29 degrees of freedom
## Multiple R-squared: 0.2662, Adjusted R-squared: 0.1143
## F-statistic: 1.753 on 6 and 29 DF, p-value: 0.1443
AIC(m4) - AIC(m5)
## [1] -1.866026
summary(m6 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7981 -0.7037 0.2120 0.6855 1.6026
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.90009 4.08998 1.932 0.0636 .
## Age -0.10727 0.14416 -0.744 0.4630
## Gender2 0.24897 0.40210 0.619 0.5408
## Item3 -0.24125 0.21801 -1.107 0.2779
## Item7 0.22313 0.18963 1.177 0.2493
## Item8 0.19217 0.11552 1.663 0.1074
## Item48 -0.05456 0.16648 -0.328 0.7456
## Item49 -0.01577 0.10666 -0.148 0.8835
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.061 on 28 degrees of freedom
## Multiple R-squared: 0.2667, Adjusted R-squared: 0.0834
## F-statistic: 1.455 on 7 and 28 DF, p-value: 0.2237
AIC(m5) - AIC(m6)
## [1] -1.971904
summary(m7 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7995 -0.6672 0.1284 0.7512 1.3917
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 10.43956 4.85975 2.148 0.0408 *
## Age -0.14472 0.14939 -0.969 0.3413
## Gender2 0.25124 0.40253 0.624 0.5378
## Item3 -0.29943 0.22633 -1.323 0.1970
## Item7 0.19310 0.19234 1.004 0.3243
## Item8 0.22122 0.11946 1.852 0.0750 .
## Item48 -0.01848 0.17076 -0.108 0.9146
## Item49 -0.02075 0.10690 -0.194 0.8475
## Item52 -0.24089 0.24834 -0.970 0.3407
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.062 on 27 degrees of freedom
## Multiple R-squared: 0.2914, Adjusted R-squared: 0.08147
## F-statistic: 1.388 on 8 and 27 DF, p-value: 0.2462
AIC(m6) - AIC(m7)
## [1] -0.7668086
AIC(m2) - AIC(m7)
## [1] 0.5550568
summary(m8 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54, data=sample))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.6630 -0.7043 0.1256 0.5801 1.9643
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 12.5057150 4.4430289 2.815 0.00918 **
## Age -0.1808285 0.1352028 -1.337 0.19266
## Gender2 0.0512890 0.3700025 0.139 0.89082
## Item3 -0.4101342 0.2079160 -1.973 0.05926 .
## Item7 0.1344454 0.1745763 0.770 0.44817
## Item8 0.0173940 0.1314257 0.132 0.89573
## Item48 0.0008866 0.1539504 0.006 0.99545
## Item49 -0.0593606 0.0973270 -0.610 0.54722
## Item52 -0.3304971 0.2260984 -1.462 0.15579
## Item54 0.3347334 0.1239762 2.700 0.01203 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9564 on 26 degrees of freedom
## Multiple R-squared: 0.4466, Adjusted R-squared: 0.255
## F-statistic: 2.331 on 9 and 26 DF, p-value: 0.0444
AIC(m7) - AIC(m8)
## [1] 6.897672
AIC(m3) - AIC(m8)
## [1] 3.664871
summary(ms2_0 <- lm(Item16 ~ Age, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.0930 -2.1233 0.0047 1.9260 2.9525
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -15.225245 0.371670 -40.96 <2e-16 ***
## Age 1.015153 0.002216 458.19 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.137 on 34 degrees of freedom
## Multiple R-squared: 0.9998, Adjusted R-squared: 0.9998
## F-statistic: 2.099e+05 on 1 and 34 DF, p-value: < 2.2e-16
summary(ms2_1 <- lm(Item16 ~ Age + Gender, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.2271 -1.8997 -0.0698 1.8778 2.8037
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -15.080532 0.474000 -31.815 <2e-16 ***
## Age 1.015382 0.002287 444.077 <2e-16 ***
## Gender2 -0.373602 0.745674 -0.501 0.62
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.161 on 33 degrees of freedom
## Multiple R-squared: 0.9998, Adjusted R-squared: 0.9998
## F-statistic: 1.027e+05 on 2 and 33 DF, p-value: < 2.2e-16
AIC(ms2_0) - AIC(ms2_1)
## [1] -1.727189
summary(ms2_2 <- lm(Item16 ~ Age + Gender + Item3, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9272 -1.6122 0.1402 1.6697 3.4614
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -16.817344 1.616874 -10.401 8.59e-12 ***
## Age 1.015599 0.002286 444.335 < 2e-16 ***
## Gender2 -0.211904 0.756563 -0.280 0.781
## Item3 0.271483 0.241721 1.123 0.270
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.153 on 32 degrees of freedom
## Multiple R-squared: 0.9998, Adjusted R-squared: 0.9998
## F-statistic: 6.898e+04 on 3 and 32 DF, p-value: < 2.2e-16
AIC(ms2_1) - AIC(ms2_2)
## [1] -0.6081615
summary(ms2_3 <- lm(Item16 ~ Age + Gender + Item3 + Item7, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.8332 -1.0203 0.2429 0.9663 2.2488
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -19.588067 1.381294 -14.181 4.27e-15 ***
## Age 1.015723 0.001769 574.163 < 2e-16 ***
## Gender2 -0.383447 0.586618 -0.654 0.518
## Item3 0.019087 0.194509 0.098 0.922
## Item7 0.821003 0.173351 4.736 4.57e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.666 on 31 degrees of freedom
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 8.639e+04 on 4 and 31 DF, p-value: < 2.2e-16
AIC(ms2_2) - AIC(ms2_3)
## [1] 17.59813
summary(ms2_4 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.8151 -0.8680 0.5295 1.0166 2.3958
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -18.781994 1.617253 -11.614 1.26e-12 ***
## Age 1.015916 0.001783 569.918 < 2e-16 ***
## Gender2 -0.428449 0.589196 -0.727 0.473
## Item3 0.012332 0.194873 0.063 0.950
## Item7 0.823870 0.173588 4.746 4.77e-05 ***
## Item8 -0.154977 0.161187 -0.961 0.344
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.668 on 30 degrees of freedom
## Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
## F-statistic: 6.894e+04 on 5 and 30 DF, p-value: < 2.2e-16
AIC(ms2_3) - AIC(ms2_4)
## [1] -0.9074324
summary(ms2_5 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.6007 -0.3932 0.0265 0.6465 1.7749
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -9.16964 1.97999 -4.631 7.06e-05 ***
## Age 0.41224 0.10288 4.007 0.000393 ***
## Gender2 -0.66994 0.40728 -1.645 0.110785
## Item3 0.08671 0.13461 0.644 0.524542
## Item7 0.55678 0.12776 4.358 0.000150 ***
## Item8 -0.11799 0.11103 -1.063 0.296678
## Item48 0.59509 0.10141 5.868 2.29e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.147 on 29 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.215e+05 on 6 and 29 DF, p-value: < 2.2e-16
AIC(ms2_4) - AIC(ms2_5)
## [1] 26.17687
AIC(ms2_3) - AIC(ms2_5)
## [1] 25.26944
summary(ms2_6 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.5735 -0.3797 0.0001 0.6846 1.7706
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.98898 2.23713 -4.018 0.00040 ***
## Age 0.40561 0.11058 3.668 0.00102 **
## Gender2 -0.69191 0.43085 -1.606 0.11951
## Item3 0.08502 0.13722 0.620 0.54055
## Item7 0.56732 0.14183 4.000 0.00042 ***
## Item8 -0.12216 0.11514 -1.061 0.29777
## Item48 0.60163 0.10902 5.519 6.73e-06 ***
## Item49 -0.02288 0.12339 -0.185 0.85424
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.167 on 28 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.007e+05 on 7 and 28 DF, p-value: < 2.2e-16
AIC(ms2_5) - AIC(ms2_6)
## [1] -1.955825
summary(ms2_7 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.3228 -0.4297 0.0191 0.6694 1.7005
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -5.890615 2.544035 -2.315 0.02842 *
## Age 0.339702 0.108322 3.136 0.00411 **
## Gender2 -1.033796 0.434742 -2.378 0.02475 *
## Item3 -0.116715 0.159143 -0.733 0.46964
## Item7 0.462615 0.141834 3.262 0.00300 **
## Item8 -0.100780 0.108690 -0.927 0.36203
## Item48 0.666367 0.106757 6.242 1.12e-06 ***
## Item49 -0.066298 0.117721 -0.563 0.57796
## Item52 -0.003519 0.001626 -2.164 0.03945 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.097 on 27 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 9.967e+04 on 8 and 27 DF, p-value: < 2.2e-16
AIC(ms2_6) - AIC(ms2_7)
## [1] 3.759547
AIC(ms2_5) - AIC(ms2_7)
## [1] 1.803722
summary(ms2_8 <- lm(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54, data=sample2))
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.3251 -0.5069 0.0008 0.6967 1.6478
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -5.329722 2.627812 -2.028 0.05290 .
## Age 0.316550 0.111700 2.834 0.00877 **
## Gender2 -1.182343 0.466397 -2.535 0.01760 *
## Item3 -0.188795 0.178628 -1.057 0.30027
## Item7 0.417730 0.150802 2.770 0.01021 *
## Item8 -0.100009 0.109075 -0.917 0.36763
## Item48 0.689274 0.110109 6.260 1.26e-06 ***
## Item49 -0.094705 0.122271 -0.775 0.44559
## Item52 -0.004377 0.001889 -2.317 0.02866 *
## Item54 0.131902 0.146434 0.901 0.37599
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.101 on 26 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 8.797e+04 on 9 and 26 DF, p-value: < 2.2e-16
AIC(ms2_7) - AIC(ms2_8)
## [1] -0.8937452
library(visreg)
par(mfrow = c(2, 2))
visreg(m8)
library(visreg)
par(mfrow = c(2, 2))
visreg(ms2_5)
# linearity
library(car)
## Loading required package: carData
par(mfrow = c(1, 3))
crPlot(m8, var = "Age")
crPlot(m8, var = "Gender")
crPlot(m8, var = "Item3")
crPlot(m8, var = "Item7")
crPlot(m8, var = "Item8")
crPlot(m8, var = "Item48")
crPlot(m8, var = "Item49")
crPlot(m8, var = "Item52")
crPlot(m8, var = "Item54")
# linearity
library(car)
par(mfrow = c(1, 3))
crPlot(ms2_5, var = "Age")
crPlot(ms2_5, var = "Gender")
crPlot(ms2_5, var = "Item3")
crPlot(ms2_5, var = "Item7")
crPlot(ms2_5, var = "Item8")
crPlot(ms2_5, var = "Item48")
par(mfrow = c(1, 1))
# autocorrelation in residuals:
acf(resid(m8))
par(mfrow = c(1, 1))
# autocorrelation in residuals:
acf(resid(ms2_5))
# multicollinearity:
car::vif(m8)
## Age Gender Item3 Item7 Item8 Item48 Item49 Item52
## 1.453910 1.309636 1.243245 1.809457 2.297028 1.197693 1.314949 1.260613
## Item54
## 2.083683
# multicollinearity: for Age and Item48, the (G)VIF > 5 - violated
car::vif(ms2_5)
## Age Gender Item3 Item7 Item8 Item48
## 7485.760893 1.102994 1.150629 1.240448 1.020859 7488.135325
# homoscedasticity:
plot(fitted(m8), resid(m8))
# homoscedasticity:
plot(fitted(ms2_5), resid(ms2_5))
# significant heteroscedasticity (p-value < 0.05)
ncvTest(m8)
## Non-constant Variance Score Test
## Variance formula: ~ fitted.values
## Chisquare = 6.395314, Df = 1, p = 0.011442
ncvTest(m2, ~Age)
## Non-constant Variance Score Test
## Variance formula: ~ Age
## Chisquare = 0.1992435, Df = 1, p = 0.65533
ncvTest(m2, ~Gender)
## Non-constant Variance Score Test
## Variance formula: ~ Gender
## Chisquare = 4.050853, Df = 1, p = 0.044149
ncvTest(m2, ~Item3)
## Non-constant Variance Score Test
## Variance formula: ~ Item3
## Chisquare = 2.090069, Df = 1, p = 0.14826
library(MASS)
MASS::boxcox(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54, data=sample)
#library(moments)
#skewness(sample$Item3, na.rm = TRUE)
#sample$Item3.transformSkew <- log10(max(sample$Item3+1) - sample$Item3)
sample$Item16.1.75 <- sample$Item16^1.75
m8 <- lm(Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54, data=sample)
summary(m8)
##
## Call:
## lm(formula = Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.9618 -4.8573 0.8645 3.9681 12.4404
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60.18787 27.89523 2.158 0.0404 *
## Age -1.01708 0.84886 -1.198 0.2417
## Gender2 0.05651 2.32303 0.024 0.9808
## Item3 -2.46764 1.30539 -1.890 0.0699 .
## Item7 0.74976 1.09606 0.684 0.5000
## Item8 0.16754 0.82515 0.203 0.8407
## Item48 0.22137 0.96657 0.229 0.8206
## Item49 -0.34235 0.61106 -0.560 0.5801
## Item52 -2.02678 1.41954 -1.428 0.1653
## Item54 2.00191 0.77838 2.572 0.0162 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.005 on 26 degrees of freedom
## Multiple R-squared: 0.4282, Adjusted R-squared: 0.2303
## F-statistic: 2.163 on 9 and 26 DF, p-value: 0.06015
ncvTest(m8)
## Non-constant Variance Score Test
## Variance formula: ~ fitted.values
## Chisquare = 3.401818, Df = 1, p = 0.065125
# no significant heteroscedasticity (p-value > 0.05)
ncvTest(ms2_5)
## Non-constant Variance Score Test
## Variance formula: ~ fitted.values
## Chisquare = 0.5398767, Df = 1, p = 0.46248
ncvTest(ms2_5, ~Age)
## Non-constant Variance Score Test
## Variance formula: ~ Age
## Chisquare = 0.51511, Df = 1, p = 0.47294
ncvTest(ms2_5, ~Gender)
## Non-constant Variance Score Test
## Variance formula: ~ Gender
## Chisquare = 2.41587, Df = 1, p = 0.12011
ncvTest(ms2_5, ~Item3)
## Non-constant Variance Score Test
## Variance formula: ~ Item3
## Chisquare = 1.550242, Df = 1, p = 0.2131
ncvTest(ms2_5, ~Item7)
## Non-constant Variance Score Test
## Variance formula: ~ Item7
## Chisquare = 1.658469, Df = 1, p = 0.19781
ncvTest(ms2_5, ~Item48)
## Non-constant Variance Score Test
## Variance formula: ~ Item48
## Chisquare = 0.53593, Df = 1, p = 0.46412
shapiro.test(resid(m8))$p.value
## [1] 0.1394061
# distribution of residuals:
qqnorm(resid(m8))
qqline(resid(m8))
shapiro.test(resid(ms2_5))$p.value
## [1] 0.05473277
# distribution of residuals:
qqnorm(resid(ms2_5))
qqline(resid(ms2_5))
summary(m8)
##
## Call:
## lm(formula = Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, data = sample)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.9618 -4.8573 0.8645 3.9681 12.4404
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60.18787 27.89523 2.158 0.0404 *
## Age -1.01708 0.84886 -1.198 0.2417
## Gender2 0.05651 2.32303 0.024 0.9808
## Item3 -2.46764 1.30539 -1.890 0.0699 .
## Item7 0.74976 1.09606 0.684 0.5000
## Item8 0.16754 0.82515 0.203 0.8407
## Item48 0.22137 0.96657 0.229 0.8206
## Item49 -0.34235 0.61106 -0.560 0.5801
## Item52 -2.02678 1.41954 -1.428 0.1653
## Item54 2.00191 0.77838 2.572 0.0162 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.005 on 26 degrees of freedom
## Multiple R-squared: 0.4282, Adjusted R-squared: 0.2303
## F-statistic: 2.163 on 9 and 26 DF, p-value: 0.06015
summary(m8) -> OLSreg1
coef=OLSreg1$coefficients[,1]
error=OLSreg1$coefficients[,2]
ci1 <- list()
for (i in 1:length(coef)){
ci1[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.995)}
ci1
## [[1]]
## [1] -11.66547 132.04121
##
## [[2]]
## [1] -3.203598 1.169442
##
## [[3]]
## [1] -5.927226 6.040247
##
## [[4]]
## [1] -5.8300938 0.8948058
##
## [[5]]
## [1] -2.073514 3.573035
##
## [[6]]
## [1] -1.957891 2.292981
##
## [[7]]
## [1] -2.268340 2.711077
##
## [[8]]
## [1] -1.916338 1.231637
##
## [[9]]
## [1] -5.683279 1.629715
##
## [[10]]
## [1] -0.003052942 4.006870563
ci5 <- list()
for (i in 1:length(coef)){
ci5[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.975)}
ci5
## [[1]]
## [1] 5.514235 114.861509
##
## [[2]]
## [1] -2.6808139 0.6466586
##
## [[3]]
## [1] -4.496550 4.609572
##
## [[4]]
## [1] -5.02615226 0.09086426
##
## [[5]]
## [1] -1.398486 2.898007
##
## [[6]]
## [1] -1.449712 1.784802
##
## [[7]]
## [1] -1.673066 2.115803
##
## [[8]]
## [1] -1.5400068 0.8553063
##
## [[9]]
## [1] -4.8090328 0.7554686
##
## [[10]]
## [1] 0.4763214 3.5274962
ci10 <- list()
for (i in 1:length(coef)){
ci10[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.95)}
ci10
## [[1]]
## [1] 14.30431 106.07143
##
## [[2]]
## [1] -2.4133291 0.3791739
##
## [[3]]
## [1] -3.764539 3.877560
##
## [[4]]
## [1] -4.6148118 -0.3204762
##
## [[5]]
## [1] -1.053105 2.552626
##
## [[6]]
## [1] -1.18970 1.52479
##
## [[7]]
## [1] -1.368491 1.811228
##
## [[8]]
## [1] -1.3474553 0.6627548
##
## [[9]]
## [1] -4.3617205 0.3081563
##
## [[10]]
## [1] 0.7215955 3.2822221
# Bootstrap OLS regression
library(boot)
##
## Attaching package: 'boot'
## The following object is masked from 'package:car':
##
## logit
bs <- function(formula, data, indices) {
d <- data[indices,]
fit <- lm(formula, data=d)
return(coef(fit))
}
Bootreg <-boot(data=sample,statistic=bs,R=1000, formula=Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54)
summary(Bootreg)
##
## Number of bootstrap replications R = 1000
## original bootBias bootSE bootMed
## 1 60.187872 -5.328387 34.81098 55.66312
## 2 -1.017078 0.151154 1.04714 -0.92964
## 3 0.056511 -0.227836 2.35701 -0.21967
## 4 -2.467644 0.251456 1.66829 -2.32203
## 5 0.749761 0.046124 1.41549 0.64732
## 6 0.167545 0.079677 0.98380 0.23233
## 7 0.221369 -0.094911 1.28520 0.24299
## 8 -0.342350 0.018686 0.76112 -0.35999
## 9 -2.026782 0.191227 1.47166 -1.88684
## 10 2.001909 -0.165543 1.11947 1.92084
pdf(file="/Users/trekkatkins/Downloads/7585259/figure1.pdf")
plot(Bootreg, index=1) # intercept
plot(Bootreg, index=2) #
plot(Bootreg, index=3) #
plot(Bootreg, index=4) #
plot(Bootreg, index=5) #
plot(Bootreg, index=6) #
plot(Bootreg, index=7) #
plot(Bootreg, index=8) #
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=1) # intercept
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 1)
##
## Intervals :
## Level Percentile
## 90% ( -7.40, 110.82 )
## 95% (-18.27, 118.07 )
## 99% (-37.34, 136.13 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=2) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 2)
##
## Intervals :
## Level Percentile
## 90% (-2.485, 0.982 )
## 95% (-2.741, 1.334 )
## 99% (-3.281, 2.138 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=3) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 3)
##
## Intervals :
## Level Percentile
## 90% (-3.9039, 3.5967 )
## 95% (-4.7546, 4.3745 )
## 99% (-6.6174, 6.6767 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=4) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 4)
##
## Intervals :
## Level Percentile
## 90% (-4.719, 0.690 )
## 95% (-5.290, 1.629 )
## 99% (-6.625, 3.652 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=5) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 5)
##
## Intervals :
## Level Percentile
## 90% (-1.1894, 3.2401 )
## 95% (-1.7555, 3.7783 )
## 99% (-3.3102, 5.8444 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=6) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 6)
##
## Intervals :
## Level Percentile
## 90% (-1.2208, 2.0133 )
## 95% (-1.4714, 2.3911 )
## 99% (-2.1298, 3.4004 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=7) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 7)
##
## Intervals :
## Level Percentile
## 90% (-2.3417, 1.8792 )
## 95% (-3.2237, 2.3696 )
## 99% (-5.1745, 3.6594 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg, type="perc", conf=c(0.90,0.95,0.99), index=8) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 8)
##
## Intervals :
## Level Percentile
## 90% (-1.4446, 0.9700 )
## 95% (-1.7170, 1.4076 )
## 99% (-2.5678, 2.2237 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
dev.off
## function (which = dev.cur())
## {
## if (which == 1)
## stop("cannot shut down device 1 (the null device)")
## .External(C_devoff, as.integer(which))
## dev.cur()
## }
## <bytecode: 0x7f9720ffc478>
## <environment: namespace:grDevices>
# Quantile regression
library(quantreg)
## Loading required package: SparseM
##
## Attaching package: 'SparseM'
## The following object is masked from 'package:base':
##
## backsolve
Qreg1 <- rq(Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54, tau = .5, data=sample)
summary(Qreg1, se="iid", bsmethod="xy")
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
##
## Call: rq(formula = Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, tau = 0.5, data = sample)
##
## tau: [1] 0.5
##
## Coefficients:
## Value Std. Error t value Pr(>|t|)
## (Intercept) 31.73732 29.52183 1.07505 0.29223
## Age 0.20938 0.89836 0.23307 0.81753
## Gender2 -1.97082 2.45849 -0.80164 0.43003
## Item3 -1.72891 1.38150 -1.25147 0.22191
## Item7 0.22903 1.15998 0.19744 0.84502
## Item8 -0.06945 0.87326 -0.07953 0.93722
## Item48 1.00049 1.02293 0.97806 0.33706
## Item49 0.01728 0.64669 0.02672 0.97889
## Item52 -2.66503 1.50232 -1.77395 0.08779
## Item54 2.22899 0.82376 2.70586 0.01187
summary(Qreg1, se="iid", bsmethod="xy") -> Qreg2
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
coef=Qreg2$coefficients[,1]
error=Qreg2$coefficients[,2]
ci1 <- list()
for (i in 1:length(coef)){
ci1[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.995)}
ci1
## [[1]]
## [1] -44.30587 107.78052
##
## [[2]]
## [1] -2.104638 2.523399
##
## [[3]]
## [1] -8.303476 4.361835
##
## [[4]]
## [1] -5.287433 1.829604
##
## [[5]]
## [1] -2.758872 3.216935
##
## [[6]]
## [1] -2.318828 2.179918
##
## [[7]]
## [1] -1.634400 3.635374
##
## [[8]]
## [1] -1.648490 1.683048
##
## [[9]]
## [1] -6.534741 1.204683
##
## [[10]]
## [1] 0.1071152 4.3508624
ci5 <- list()
for (i in 1:length(coef)){
ci5[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.975)}
ci5
## [[1]]
## [1] -26.12440 89.59905
##
## [[2]]
## [1] -1.551370 1.970131
##
## [[3]]
## [1] -6.789376 2.847735
##
## [[4]]
## [1] -4.4366128 0.9787834
##
## [[5]]
## [1] -2.044482 2.502545
##
## [[6]]
## [1] -1.781016 1.642107
##
## [[7]]
## [1] -1.004414 3.005388
##
## [[8]]
## [1] -1.250214 1.284772
##
## [[9]]
## [1] -5.6095162 0.2794582
##
## [[10]]
## [1] 0.6144424 3.8435351
ci10 <- list()
for (i in 1:length(coef)){
ci10[[i]] <- coef[i] + c(-1,1)*error[i]*qnorm(0.95)}
ci10
## [[1]]
## [1] -16.82177 80.29641
##
## [[2]]
## [1] -1.268288 1.687049
##
## [[3]]
## [1] -6.014680 2.073039
##
## [[4]]
## [1] -4.0012866 0.5434572
##
## [[5]]
## [1] -1.678962 2.137024
##
## [[6]]
## [1] -1.505842 1.366933
##
## [[7]]
## [1] -0.6820792 2.6830532
##
## [[8]]
## [1] -1.046435 1.080993
##
## [[9]]
## [1] -5.1361206 -0.1939374
##
## [[10]]
## [1] 0.8740188 3.5839588
library(quantreg) bs <- function(formula, data, indices) { d <- data[indices,]
fit <- rq(formula, tau=0.5, data=d) return(coef(fit)) } library(quantreg) library(boot) Bootreg <-boot(data=sample,statistic=bs,R=1000, formula=Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 + Item48 + Item49 + Item52 + Item54) summary(Bootreg) pdf(file=“/Users/trekkatkins/Downloads/7585259/figure2.pdf”) plot(Bootreg, index=1) # intercept plot(Bootreg, index=2) # plot(Bootreg, index=3) # plot(Bootreg, index=4) #
plot(Bootreg, index=5) # plot(Bootreg, index=6) # plot(Bootreg, index=7) #
plot(Bootreg, index=8) #
boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99),index=1) # intercept boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99),index=2) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99),index=3) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99),index=4) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99), index=5) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99), index=6) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99), index=7) # boot.ci(Bootreg, type=“perc”, conf=c(0.90,0.95,0.99), index=8) # library(quantreg)
dev.off
summary(ms2_5)
##
## Call:
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48, data = sample2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.6007 -0.3932 0.0265 0.6465 1.7749
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -9.16964 1.97999 -4.631 7.06e-05 ***
## Age 0.41224 0.10288 4.007 0.000393 ***
## Gender2 -0.66994 0.40728 -1.645 0.110785
## Item3 0.08671 0.13461 0.644 0.524542
## Item7 0.55678 0.12776 4.358 0.000150 ***
## Item8 -0.11799 0.11103 -1.063 0.296678
## Item48 0.59509 0.10141 5.868 2.29e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.147 on 29 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 1.215e+05 on 6 and 29 DF, p-value: < 2.2e-16
summary(ms2_5) -> OLSreg2
coef2=OLSreg2$coefficients[,1]
error2=OLSreg2$coefficients[,2]
ci2_1 <- list()
for (i in 1:length(coef2)){
ci2_1[[i]] <- coef2[i] + c(-1,1)*error2[i]*qnorm(0.995)}
ci2_1
## [[1]]
## [1] -14.269756 -4.069529
##
## [[2]]
## [1] 0.1472319 0.6772517
##
## [[3]]
## [1] -1.7190170 0.3791407
##
## [[4]]
## [1] -0.2600303 0.4334523
##
## [[5]]
## [1] 0.2276858 0.8858662
##
## [[6]]
## [1] -0.4039822 0.1679977
##
## [[7]]
## [1] 0.3338657 0.8563093
ci2_5 <- list()
for (i in 1:length(coef2)){
ci2_5[[i]] <- coef2[i] + c(-1,1)*error2[i]*qnorm(0.975)}
ci2_5
## [[1]]
## [1] -13.050349 -5.288935
##
## [[2]]
## [1] 0.2105942 0.6138894
##
## [[3]]
## [1] -1.4681885 0.1283123
##
## [[4]]
## [1] -0.1771266 0.3505485
##
## [[5]]
## [1] 0.3063693 0.8071827
##
## [[6]]
## [1] -0.33560368 0.09961925
##
## [[7]]
## [1] 0.3963222 0.7938527
ci2_10 <- list()
for (i in 1:length(coef2)){
ci2_10[[i]] <- coef2[i] + c(-1,1)*error2[i]*qnorm(0.95)}
ci2_10
## [[1]]
## [1] -12.42643 -5.91285
##
## [[2]]
## [1] 0.2430138 0.5814698
##
## [[3]]
## [1] -1.339851e+00 -2.528726e-05
##
## [[4]]
## [1] -0.1347085 0.3081304
##
## [[5]]
## [1] 0.3466281 0.7669240
##
## [[6]]
## [1] -0.30061751 0.06463308
##
## [[7]]
## [1] 0.4282784 0.7618965
# Bootstrap OLS regression
library(boot)
bs <- function(formula, data, indices) {
d <- data[indices,]
fit <- lm(formula, data=d)
return(coef(fit))
}
Bootreg2 <-boot(data=sample2,statistic=bs,R=1000, formula=Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48)
summary(Bootreg2)
##
## Number of bootstrap replications R = 1000
## original bootBias bootSE bootMed
## 1 -9.169642 2.5496622 3.70813 -7.170998
## 2 0.412242 -0.0845372 0.13561 0.339494
## 3 -0.669938 0.0077257 0.45872 -0.629844
## 4 0.086711 -0.0062995 0.20395 0.079166
## 5 0.556776 -0.0520218 0.16480 0.511920
## 6 -0.117992 0.0474462 0.16733 -0.079980
## 7 0.595087 -0.1117392 0.23335 0.555657
pdf(file="/Users/trekkatkins/Downloads/7585259/figure3.pdf")
plot(Bootreg2, index=1) # intercept
plot(Bootreg2, index=2) #
plot(Bootreg2, index=3) #
plot(Bootreg2, index=4) #
plot(Bootreg2, index=5) #
plot(Bootreg2, index=6) #
plot(Bootreg2, index=7) #
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=1) # intercept
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 1)
##
## Intervals :
## Level Percentile
## 90% (-11.684, 0.299 )
## 95% (-12.237, 1.342 )
## 99% (-13.593, 3.855 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=2) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 2)
##
## Intervals :
## Level Percentile
## 90% ( 0.0931, 0.5312 )
## 95% ( 0.0564, 0.5672 )
## 99% (-0.0349, 0.6287 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=3) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 3)
##
## Intervals :
## Level Percentile
## 90% (-1.4552, 0.0204 )
## 95% (-1.6668, 0.1756 )
## 99% (-2.2482, 0.4214 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=4) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 4)
##
## Intervals :
## Level Percentile
## 90% (-0.2243, 0.3987 )
## 95% (-0.2893, 0.5053 )
## 99% (-0.4288, 0.7170 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=5) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 5)
##
## Intervals :
## Level Percentile
## 90% ( 0.2199, 0.7589 )
## 95% ( 0.1623, 0.8116 )
## 99% (-0.0583, 0.9226 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=6) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 6)
##
## Intervals :
## Level Percentile
## 90% (-0.3212, 0.2217 )
## 95% (-0.3653, 0.2958 )
## 99% (-0.4732, 0.4563 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99), index=7) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 7)
##
## Intervals :
## Level Percentile
## 90% ( 0.0227, 0.7444 )
## 95% (-0.0931, 0.7898 )
## 99% (-0.2830, 0.8686 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
dev.off
## function (which = dev.cur())
## {
## if (which == 1)
## stop("cannot shut down device 1 (the null device)")
## .External(C_devoff, as.integer(which))
## dev.cur()
## }
## <bytecode: 0x7f9720ffc478>
## <environment: namespace:grDevices>
# Quantile regression
library(quantreg)
Qreg3 <- rq(Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48, tau = .5, data=sample2)
summary(Qreg3, se="iid", bsmethod="xy")
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
##
## Call: rq(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48, tau = 0.5, data = sample2)
##
## tau: [1] 0.5
##
## Coefficients:
## Value Std. Error t value Pr(>|t|)
## (Intercept) -4.81568 1.42306 -3.38404 0.00206
## Age 0.28679 0.07394 3.87847 0.00056
## Gender2 -0.38895 0.29272 -1.32876 0.19429
## Item3 -0.06352 0.09675 -0.65656 0.51664
## Item7 0.38113 0.09182 4.15067 0.00027
## Item8 -0.24932 0.07980 -3.12443 0.00402
## Item48 0.71833 0.07289 9.85532 0.00000
summary(Qreg3, se="iid", bsmethod="xy") -> Qreg4
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
coef3=Qreg4$coefficients[,1]
error4=Qreg4$coefficients[,2]
ci3_1 <- list()
for (i in 1:length(coef3)){
ci3_1[[i]] <- coef3[i] + c(-1,1)*error4[i]*qnorm(0.995)}
ci3_1
## [[1]]
## [1] -8.481226 -1.150127
##
## [[2]]
## [1] 0.09632247 0.47725786
##
## [[3]]
## [1] -1.1429466 0.3650397
##
## [[4]]
## [1] -0.3127316 0.1856877
##
## [[5]]
## [1] 0.1446082 0.6176552
##
## [[6]]
## [1] -0.45487044 -0.04377749
##
## [[7]]
## [1] 0.5305823 0.9060726
ci3_5 <- list()
for (i in 1:length(coef3)){
ci3_5[[i]] <- coef3[i] + c(-1,1)*error4[i]*qnorm(0.975)}
ci3_5
## [[1]]
## [1] -7.604815 -2.026538
##
## [[2]]
## [1] 0.1418621 0.4317182
##
## [[3]]
## [1] -0.9626714 0.1847644
##
## [[4]]
## [1] -0.2531471 0.1261032
##
## [[5]]
## [1] 0.2011596 0.5611038
##
## [[6]]
## [1] -0.40572551 -0.09292242
##
## [[7]]
## [1] 0.5754711 0.8611839
ci3_10 <- list()
for (i in 1:length(coef)){
ci3_10[[i]] <- coef3[i] + c(-1,1)*error4[i]*qnorm(0.95)}
ci3_10
## [[1]]
## [1] -7.156395 -2.474957
##
## [[2]]
## [1] 0.1651627 0.4084176
##
## [[3]]
## [1] -0.87043273 0.09252578
##
## [[4]]
## [1] -0.22266037 0.09561647
##
## [[5]]
## [1] 0.2300943 0.5321691
##
## [[6]]
## [1] -0.3805803 -0.1180677
##
## [[7]]
## [1] 0.5984386 0.8382164
##
## [[8]]
## [1] NA NA
##
## [[9]]
## [1] NA NA
##
## [[10]]
## [1] NA NA
# Bootstrap Qunantile regression
library(quantreg)
bs <- function(formula, data, indices) {
d <- data[indices,]
fit <- rq(formula, tau=0.5, data=d)
return(coef(fit))
}
library(quantreg)
library(boot)
Bootreg2 <-boot(data=sample2,statistic=bs,R=1000, formula=Item16 ~ Age + Gender + Item3 + Item7 + Item8 + Item48)
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
## Warning in rq.fit.br(x, y, tau = tau, ...): Solution may be nonunique
summary(Bootreg2)
##
## Number of bootstrap replications R = 1000
## original bootBias bootSE bootMed
## 1 -4.815676 -0.7048871 4.26996 -5.588947
## 2 0.286790 0.0184882 0.14335 0.289179
## 3 -0.388953 0.0024096 0.44246 -0.358754
## 4 -0.063522 0.0921699 0.22539 -0.025051
## 5 0.381132 0.1264780 0.27527 0.452632
## 6 -0.249324 0.0875476 0.16119 -0.166667
## 7 0.718327 -0.2250731 0.27752 0.577030
pdf(file="/Users/trekkatkins/Downloads/7585259/figure4.pdf")
plot(Bootreg2, index=1) # intercept
plot(Bootreg2, index=2) #
plot(Bootreg2, index=3) #
plot(Bootreg2, index=4) #
plot(Bootreg2, index=5) #
plot(Bootreg2, index=6) #
plot(Bootreg2, index=7) #
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=1) # intercept
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 1)
##
## Intervals :
## Level Percentile
## 90% (-11.886, 1.627 )
## 95% (-13.466, 3.111 )
## 99% (-15.741, 6.463 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=2) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 2)
##
## Intervals :
## Level Percentile
## 90% ( 0.0932, 0.5537 )
## 95% ( 0.0345, 0.6165 )
## 99% (-0.1294, 0.7191 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=3) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 3)
##
## Intervals :
## Level Percentile
## 90% (-1.0323, 0.2812 )
## 95% (-1.2856, 0.4145 )
## 99% (-2.4281, 0.7827 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=4) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 4)
##
## Intervals :
## Level Percentile
## 90% (-0.2365, 0.4468 )
## 95% (-0.3389, 0.5823 )
## 99% (-0.5970, 0.9220 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=5) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 5)
##
## Intervals :
## Level Percentile
## 90% ( 0.0591, 0.9589 )
## 95% ( 0.0212, 1.0137 )
## 99% (-0.0858, 1.0860 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=6) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 6)
##
## Intervals :
## Level Percentile
## 90% (-0.3706, 0.1391 )
## 95% (-0.4077, 0.2455 )
## 99% (-0.5550, 0.5806 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
boot.ci(Bootreg2, type="perc", conf=c(0.90,0.95,0.99),index=7) #
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 1000 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = Bootreg2, conf = c(0.9, 0.95, 0.99), type = "perc",
## index = 7)
##
## Intervals :
## Level Percentile
## 90% (-0.0536, 0.7736 )
## 95% (-0.2142, 0.8162 )
## 99% (-0.6705, 0.9330 )
## Calculations and Intervals on Original Scale
## Some percentile intervals may be unstable
library(quantreg)
dev.off
## function (which = dev.cur())
## {
## if (which == 1)
## stop("cannot shut down device 1 (the null device)")
## .External(C_devoff, as.integer(which))
## dev.cur()
## }
## <bytecode: 0x7f9720ffc478>
## <environment: namespace:grDevices>
library(lmSupport)
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
summary(m8)$adj.r.squared # adjusted R^2
## [1] 0.2302801
summary(ms2_5)$adj.r.squared # adjusted R^2
## [1] 0.999952
modelEffectSizes(m8) # partial eta-squared
## lm(formula = Item16.1.75 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48 + Item49 + Item52 + Item54, data = sample)
##
## Coefficients
## SSR df pEta-sqr dR-sqr
## (Intercept) 167.8519 1 0.1519 NA
## Age 51.7611 1 0.0523 0.0316
## Gender 0.0213 1 0.0000 0.0000
## Item3 128.8415 1 0.1208 0.0786
## Item7 16.8710 1 0.0177 0.0103
## Item8 1.4865 1 0.0016 0.0009
## Item48 1.8912 1 0.0020 0.0012
## Item49 11.3173 1 0.0119 0.0069
## Item52 73.4998 1 0.0727 0.0448
## Item54 238.4947 1 0.2028 0.1455
##
## Sum of squared errors (SSE): 937.4
## Sum of squared total (SST): 1639.5
modelEffectSizes(ms2_5) # partial eta-squared
## lm(formula = Item16 ~ Age + Gender + Item3 + Item7 + Item8 +
## Item48, data = sample2)
##
## Coefficients
## SSR df pEta-sqr dR-sqr
## (Intercept) 28.2226 1 0.4251 NA
## Age 21.1267 1 0.3563 0
## Gender 3.5604 1 0.0853 0
## Item3 0.5460 1 0.0141 0
## Item7 24.9909 1 0.3957 0
## Item8 1.4861 1 0.0375 0
## Item48 45.3100 1 0.5428 0
##
## Sum of squared errors (SSE): 38.2
## Sum of squared total (SST): 959172.3